package com.archgeek.rpc.pekko.remote;

import com.archgeek.rpc.service.IUserInfoSerivce;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.apache.pekko.actor.AbstractActor;
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.actor.Props;
import org.apache.pekko.japi.pf.ReceiveBuilder;

/**
 * @author pizhihui
 * @date 2024-05-23 09:11
 */
public class SystemServer {


    public static void main(String[] args) {

        System.setProperty("pekko.loglevel", "info");
        System.setProperty("pekko.actor.provider", "remote");
        System.setProperty("pekko.actor.warn-about-java-serializer-usage", "off");
        System.setProperty("pekko.actor.allow-java-serialization", "on");

        System.setProperty("pekko.remote.artery.canonical.hostname", "127.0.0.1");
        System.setProperty("pekko.remote.artery.canonical.port", "17338");


        Config config = ConfigFactory.load();
        ActorSystem actorSystem = ActorSystem.create("actor-system", config);


        actorSystem.actorOf(Props.create(UserInfoActor.class), "actor-server");

    }


}

class UserInfoActor extends AbstractActor {


    @Override
    public Receive createReceive() {
        return ReceiveBuilder.create()
                .match(HEvent.class, this::handleEvent)
                .build();
    }

    public void handleEvent(HEvent hEvent) {
        System.out.println("收到信息,开始处理.....");



    }

}


